package cn.vin.storm;

import com.aliyun.odps.*;
import com.aliyun.odps.account.Account;
import com.aliyun.odps.account.AliyunAccount;
import com.aliyun.odps.tunnel.TableTunnel;
import com.aliyun.odps.tunnel.TunnelException;

import java.util.List;

public class Demo2 {
    public static void main(String[] args) throws OdpsException {
        Account account = new AliyunAccount("LTAIUxp8SmvWpTKR","GpwtKpvvI1tKlGCg1PQXqB1lZvbIBZ");
        Odps odps = new Odps(account);
        String odpsUrl = "http://service.cn.maxcompute.aliyun.com/api";
        odps.setEndpoint(odpsUrl);
        odps.setDefaultProject("kariqu");
        Table table = odps.tables().get("csxt_event");
        PartitionSpec partSpec = new PartitionSpec("gmt_create='20190826'");
        table.createPartition(partSpec,true);

        TableTunnel tableTunnel = new TableTunnel(odps);
        TableTunnel.UploadSession uploadSession;
        try {

            uploadSession = tableTunnel.createUploadSession("kariqu", "csxt_event",partSpec);
        } catch (TunnelException e) {
            throw e;
        }
        System.out.println("==============");
    }
}
